<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS布局小技巧</title>
    <style>
        .outer{
            width: 400px;
            height: 400px;
            background-color: gray;
            overflow: hidden; /* 解决margin坍塌*/
        }
        .inner{
            width: 200px;
            height: 100px;
            background-color: orange;
            margin: 0 auto; /* 水平居中*/
            margin-top: 150px; /* （400-100)/2*/
        }
    </style>
</head>
<body>
    <div class="outer">
        <div class="inner">inner</div>
    </div>
</body>
</html>